Optimal. Leaf size=119 \[ \frac{b \left (6 a^2 B+6 a A b+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac{a^2 (2 a A-b B) \sin (c+d x)}{2 d}+a^2 x (a B+3 A b)+\frac{b^2 (2 a B+A b) \tan (c+d x)}{d}+\frac{b B \sin (c+d x) (a+b \sec (c+d x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.223205, antiderivative size = 131, normalized size of antiderivative = 1.1, number of steps used = 6, number of rules used = 5, integrand size = 29, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.172, Rules used = {4025, 4048, 3770, 3767, 8} \[ -\frac{b \left (2 a^2 A-3 a b B-A b^2\right ) \tan (c+d x)}{d}+\frac{b \left (6 a^2 B+6 a A b+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^2 x (a B+3 A b)-\frac{b^2 (2 a A-b B) \tan (c+d x) \sec (c+d x)}{2 d}+\frac{a A \sin (c+d x) (a+b \sec (c+d x))^2}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4025
Rule 4048
Rule 3770
Rule 3767
Rule 8
Rubi steps
\begin{align*} \int \cos (c+d x) (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx &=\frac{a A (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\int (a+b \sec (c+d x)) \left (-a (3 A b+a B)-b (A b+2 a B) \sec (c+d x)+b (2 a A-b B) \sec ^2(c+d x)\right ) \, dx\\ &=\frac{a A (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\frac{b^2 (2 a A-b B) \sec (c+d x) \tan (c+d x)}{2 d}-\frac{1}{2} \int \left (-2 a^2 (3 A b+a B)-b \left (6 a A b+6 a^2 B+b^2 B\right ) \sec (c+d x)+2 b \left (2 a^2 A-A b^2-3 a b B\right ) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 (3 A b+a B) x+\frac{a A (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\frac{b^2 (2 a A-b B) \sec (c+d x) \tan (c+d x)}{2 d}-\left (b \left (2 a^2 A-A b^2-3 a b B\right )\right ) \int \sec ^2(c+d x) \, dx+\frac{1}{2} \left (b \left (6 a A b+6 a^2 B+b^2 B\right )\right ) \int \sec (c+d x) \, dx\\ &=a^2 (3 A b+a B) x+\frac{b \left (6 a A b+6 a^2 B+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac{a A (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\frac{b^2 (2 a A-b B) \sec (c+d x) \tan (c+d x)}{2 d}+\frac{\left (b \left (2 a^2 A-A b^2-3 a b B\right )\right ) \operatorname{Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d}\\ &=a^2 (3 A b+a B) x+\frac{b \left (6 a A b+6 a^2 B+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac{a A (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\frac{b \left (2 a^2 A-A b^2-3 a b B\right ) \tan (c+d x)}{d}-\frac{b^2 (2 a A-b B) \sec (c+d x) \tan (c+d x)}{2 d}\\ \end{align*}
Mathematica [B] time = 0.962975, size = 399, normalized size = 3.35 \[ \frac{\sec ^2(c+d x) \left (\left (a^3 A+2 b^3 B\right ) \sin (c+d x)+\cos (2 (c+d x)) \left (-b \left (6 a^2 B+6 a A b+b^2 B\right ) \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )+b \left (6 a^2 B+6 a A b+b^2 B\right ) \log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )+2 a^2 (c+d x) (a B+3 A b)\right )+6 a^2 A b c+6 a^2 A b d x+a^3 A \sin (3 (c+d x))-6 a^2 b B \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )+6 a^2 b B \log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )+2 a^3 B c+2 a^3 B d x-6 a A b^2 \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )+6 a A b^2 \log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )+6 a b^2 B \sin (2 (c+d x))+2 A b^3 \sin (2 (c+d x))-b^3 B \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )+b^3 B \log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )\right )}{4 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.054, size = 172, normalized size = 1.5 \begin{align*}{\frac{A{a}^{3}\sin \left ( dx+c \right ) }{d}}+B{a}^{3}x+{\frac{B{a}^{3}c}{d}}+3\,A{a}^{2}bx+3\,{\frac{A{a}^{2}bc}{d}}+3\,{\frac{B{a}^{2}b\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{d}}+3\,{\frac{Aa{b}^{2}\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{d}}+3\,{\frac{Ba{b}^{2}\tan \left ( dx+c \right ) }{d}}+{\frac{A{b}^{3}\tan \left ( dx+c \right ) }{d}}+{\frac{B{b}^{3}\sec \left ( dx+c \right ) \tan \left ( dx+c \right ) }{2\,d}}+{\frac{B{b}^{3}\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{2\,d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 0.982723, size = 228, normalized size = 1.92 \begin{align*} \frac{4 \,{\left (d x + c\right )} B a^{3} + 12 \,{\left (d x + c\right )} A a^{2} b - B b^{3}{\left (\frac{2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, B a^{2} b{\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, A a b^{2}{\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, A a^{3} \sin \left (d x + c\right ) + 12 \, B a b^{2} \tan \left (d x + c\right ) + 4 \, A b^{3} \tan \left (d x + c\right )}{4 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 0.562001, size = 401, normalized size = 3.37 \begin{align*} \frac{4 \,{\left (B a^{3} + 3 \, A a^{2} b\right )} d x \cos \left (d x + c\right )^{2} +{\left (6 \, B a^{2} b + 6 \, A a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) -{\left (6 \, B a^{2} b + 6 \, A a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \,{\left (2 \, A a^{3} \cos \left (d x + c\right )^{2} + B b^{3} + 2 \,{\left (3 \, B a b^{2} + A b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.22502, size = 325, normalized size = 2.73 \begin{align*} \frac{\frac{4 \, A a^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )}{\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 1} + 2 \,{\left (B a^{3} + 3 \, A a^{2} b\right )}{\left (d x + c\right )} +{\left (6 \, B a^{2} b + 6 \, A a b^{2} + B b^{3}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 1 \right |}\right ) -{\left (6 \, B a^{2} b + 6 \, A a b^{2} + B b^{3}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 1 \right |}\right ) - \frac{2 \,{\left (6 \, B a b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} + 2 \, A b^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - B b^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 6 \, B a b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 2 \, A b^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - B b^{3} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 1\right )}^{2}}}{2 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]